<template>
  <div>
    <el-header height="36px">
      <header-title :title="headerTitle" />
    </el-header>
    <el-main>
      <el-collapse
        v-for="item in collapseList"
        :key="item.components"
        v-model="activeNames"
      >
        <el-collapse-item :name="item.components">
          <template v-if="item.title" slot="title">
            <i class="item_icon" />{{ item.title }}
          </template>
          <template v-if="item.iframe">
            <iframe
              :ref="item.components"
              :src="item.url"
              width="100%"
              :height="`${item.height}`"
              frameborder="0"
              scrolling="no"
            />
          </template>
          <div v-else class="content-box">
            <component
                :prjType="prjTypes"
              :is="item.components"
              :ref="item.components"
              :prj-id="prjId"
              :c-inspection-form="inspectionForm"
              :node-name-word="nodeNameWord"
              show-type="0"
              :it-acc-id="itAccId"
              :process-inst-id="lcList.processInstID"
              :prj-stage="prjStage"
              @CInspectionForm="cInspectionForm"
              @InspectionValuationDetails="
                inspectionValuationDetails
              "
              @validForm="validForm"
              @LookaSsessResult="LookaSsessResult"
            />
          </div>
        </el-collapse-item>
      </el-collapse>
      <div v-if="query.type === 'done'" class="flex-layout">
        <el-button
          class="pms-button-primary"
          @click="handleOnlyClose"
        >关闭</el-button>
      </div>
      <div v-else class="flex-layout">
        <el-button
          v-if="+query.queryType !== 3"
          class="pms-button-primary"
          @click="handleSave"
        >保存</el-button>
        <el-button
          v-if="!query.subType"
          class="pms-button-primary"
          @click="handleNext"
        >下一步</el-button>
        <el-button
          v-if="backBtn"
          class="pms-button-primary"
          @click="doBack"
        >回退</el-button>
        <el-button
          v-if="!query.subType && nodeNameWord === 'alliv01new'"
          class="pms-button-primary"
          @click="deleteApproval"
        >取消申请</el-button>
        <el-button
          v-if="+query.queryType === 1 || +query.queryType === 2"
          class="pms-button-primary"
          @click="handleClose"
        >关闭</el-button>
        <el-button
          v-else
          class="pms-button-primary"
          @click="handleOnlyClose"
        >关闭</el-button>
      </div>
    </el-main>
    <!-- // 下一步 && 回退 -->
    <next-page
      v-if="nextPageVisible"
      ref="nextPage"
      :visible.sync="nextPageVisible"
      :activity-inst-id="workFlowData.activityInstID"
      :process-inst-id="workFlowData.processInstID"
      :activity-def-id="workFlowData.activityDefID"
      :process-def-name="workFlowData.processDefName"
      :route="workFlowData.route"
      @doNextEntity="nextPageRes"
    />
    <Back-page
      v-if="backPageVisible"
      ref="backPage"
      :visible.sync="backPageVisible"
      :process-inst-id="workFlowData.processInstID"
      :act-inset-id="workFlowData.actInsetId"
      @doReturn="backPageRes"
    />
  </div>
</template>

<script>
import CInspectionDetailsView from './components/CInspectionDetailsView.vue'
import CInspectionForm from '@/views/checkoutValuation/components/CInspectionForm'
import basicPrjInfo from '@/views/checkoutValuation/components/basicPrjInfo'
import onlyPrjInfo from '@/views/checkoutValuation/components/onlyPrjInfo'
import {
    getWFWorkItemNew,
    getPrjDetail,
    selectItAccInfo,
    getItInspectionNew,
    delInsVal,
    addInsVal,
    insValNextCheckNew,
    selectIsPushNew,
    queryTheNextStepFlagNew,
    budgetControlByItAccIdNew,
    checkValidNew,
    cancelInspectionVaWorkflowNew,
    itInsValSentToSHNew,
    insValFlowBizNew,
    insValFlowBackBizNew,
    getUserInfoNew,
    applyTokenByCodeNew,
    generateMDNew,
    doNextStrongcheck,
    nextSubCode,
    newDoNextCheckVerfic
} from '@/api/checkoutValuation'
import NextPage from '@/components/nextPerson/NextPage'
import BackPage from '@/components/nextPerson/BackPage'
import HeaderTitle from '@/components/basic/HeaderTitle'

import JnSiteList from '@/components/zr/ZrAttachmetl.vue'
import JnTaskDetail from '@/components/jn/JnTaskDetail.vue'
import { NODE_NAME } from './enum/textEnum'
import { clonePage } from '@/utils'

export default {
    name: 'InspectionValuationDetailsView',
    components: {
        CInspectionForm,
        CInspectionDetailsView,
        basicPrjInfo,
        onlyPrjInfo,
        NextPage,
        BackPage,
        HeaderTitle,
        JnSiteList,
        JnTaskDetail
    },
    data() {
        return {
            headerTitle: '',
            collapseList: [
                {
                    iframe: true,
                    title: '项目基础详情',
                    components: 'basicInfo',
                    height: '250px',
                    url: null
                },
                // { title: '项目基础信息', components: 'basicPrjInfo' },
                {
                    iframe: true,
                    title: '项目专属信息',
                    components: 'getPrjInfo',
                    height: '28px',
                    url: null
                },
                { title: '验工计价基本信息', components: 'CInspectionForm' },
                {
                    title: '验工计价详情',
                    components: 'CInspectionDetailsView'
                }
            ],
            activeNames: [
                'CInspectionForm',
                'CInspectionDetailsView',
                'basicInfo',
                'getPrjInfo',
                'onlyPrjInfo',
                'JnSiteList',
                'JnTaskDetail'
            ],
            cInspectionFormData: {},
            inspectionValuationDetailsData: [],
            basicList: {}, // 基本信息
            nextPageVisible: false, // 下一步
            backPageVisible: false, // 回退
            junNanUrl: process.env.VUE_APP_JUNNAN_IFRAME_URL, // 拼+ 端口号
            workFlowData: {
                activityInstID: null,
                processInstID: null, // 下一步 && 回退
                activityDefID: null,
                actInsetId: null, // 下一步 && 回退
                route: null,
                processDefName: ''
            },
            prjId: '',
            lcList: {}, // 获取流程信息
            basicInfoList: {}, // 获取ifarm基本信息
            ifFlagVal: '', // 流程节点路由,
            validFormRes: false,
            inspectionForm: {},
            itAccIdRes: '', // 从流程中获取的itAccId
            prjStage: 'E',
            prjTypes:''
        }
    },
    computed: {
        query() {
            return this.$route.query
        },
        // 关闭按钮显示校验
        closeState() {
            return +this.query.queryType === 3
        },
        nodeNameWord() {
            return this.lcList.activityDefID
        },
        backBtn() {
            return !(this.nodeNameWord === 'alliv01new') && !this.query.subType
        },
        itAccId() {
            if (+this.query.queryType === 1 || +this.query.queryType === 2) {
                console.log(this.query.itAccId)
                return this.query.itAccId
            }
            return this.itAccIdRes
        }
    },
    mounted() {
        this.getList() // 获取ifarm的基本信息
    },
    async created() {
        // 获取流程信息
        if (this.$route.query.workItemId) {
            const getWFWorkItem = await getWFWorkItemNew({
                workItemId: this.$route.query.workItemId
            })
            if (getWFWorkItem.code === '200') {
                this.lcList = getWFWorkItem.data // 获取流程参数信息
                console.log(this.lcList.processInstID, 1111111)
                this.prjId = getWFWorkItem.data.bizObject.prjId
                this.prjStage = getWFWorkItem.data.bizObject?.wfStage || 'E'
                this.itAccIdRes = this.lcList.bizObject.bizSeq
            }
        } else {
            this.prjId = this.$route.query.prjId
        }
        if (this.prjId) {
            this.collapseList.push({
                title: '附件上传',
                components: 'JnSiteList'
            })
            this.collapseList.push({
                title: '项目审批信息',
                components: 'JnTaskDetail'
            })
        }
        await this.getBasicList() // 获取基本信息
    },
    beforeDestroy() {
        localStorage.setItem('pmsZrCheckoutValuation', 0)
    },
    methods: {
        validForm(val) {
            this.validFormRes = val
        },
        async ifarmSrcPram() {
            const _res1 = this.basicList.prjType ==='M' ? 'design/basicInfo' :'design/projectBasicInfo'
            const _res2 = this.basicList.prjType ==='M' ? 'design/proprietaryInfo' :'design/projectProprietaryInfo'
            // 基本信息
            this.collapseList.find((item) => {
                return item.components === 'basicInfo'
            }).url = `${this.junNanUrl}${_res1}?prjId=${this.prjId}`
            //  项目的专属信息
            this.collapseList.find((item) => {
                return item.components === 'getPrjInfo'
            }).url = `${this.junNanUrl}${_res2}?prjId=${this.prjId}&secondaryType=${this.basicList.secondaryType}`
        },
        getList() {
            window.addEventListener('message', (event) => {
                const base_url = ''
              if (event.origin === base_url) {
                return
              }
                if (event.data.type === 'basicInfo') {
                    this.basicInfoList = JSON.parse(event.data.data)
                }
                if (event.data.type === 'proiprHeight') {
                    this.collapseList.find((item) => {
                        return item.components === 'getPrjInfo'
                    }).height = event.data.data
                }
            })
        },
        // 获取基本信息
        async getBasicList() {
            await getPrjDetail({ prjId: this.prjId }).then((res) => {
                this.basicList = res.data // 获取基本信息
                this.headerTitle = res.data.prjName
                this.prjTypes = this.basicList.prjType==='M'?'':this.basicList.prjType
            })
            // 获取验工计价基本信息
            if (this.query.type === 'todo' || this.query.type === 'done') {
                  const res = await selectItAccInfo({
                ITAccId: this.lcList?.bizObject?.bizSeq
            })
            if (+res.code === 200) {
                this.inspectionForm = res.data[0]
            }
            }
            console.log(this.basicList,"this.basicList");
            
            this.ifarmSrcPram() // ifarm 初始化方法
        },
        // 关闭
        async handleClose() {
            var flag = false
            var itAccId = this.query.itAccId // 需要参数

            const getItInspection = await getItInspectionNew({
                itAccId: itAccId
            })
            if (getItInspection.code === '200') {
                var resultMess = getItInspection.data
                if (resultMess === 'err') {
                    flag = true
                }
            }
            if (flag) {
                this.$message({
                    message:
                        '请将本次填写的验工计价信息删除在取消本次验工计价！',
                    type: 'error'
                })
                // nui.alert("请将本次填写的验工计价信息删除在取消本次验工计价！")
                return
            }
            const params = {
                itAccId: this.query.itAccId,
                prjId: this.query.prjId
            }
            const res = await delInsVal(params)
            if (+res.code === 200) {
                localStorage.setItem('pmsZrCheckoutValuation', 0)
              clonePage()
            }
        },

        // 保存
        async handleSave() {
            if (NODE_NAME.includes(this.nodeNameWord)) {
            //    clonePage()
                this.$message.success('保存成功')
                return
            }
            this.$refs.CInspectionForm[0].formValid()
            if (!this.validFormRes) {
                return
            }
            // const itAccId
            const params = {
                prjId: this.query.prjId,
                itAccInfo: {
                    insvalMonth: this.cInspectionFormData.month,
                    accTime: this.cInspectionFormData.createTime,
                    accContent: this.cInspectionFormData.accContent
                },
                insValInfos: [],
                itAccId: this.query.itAccId,
                insValType: this.query.queryType,
                secondarytype: this.basicList.secondaryType,
                workItemId: this.query.workItemId
            }
            const res = await addInsVal(params)
            if (+res.code === 200) {
                this.$message.success(res.message)
                localStorage.setItem('pmsZrCheckoutValuation', 0)
               clonePage()
            }
        },
        async Strongcheck(){
            if (this.lcList.activityDefID === 'alliv01new') {
                const { code } = await doNextStrongcheck({
                    iTAccId: this.lcList.bizObject.bizSeq
                })
                if(+code!==200){
                    return Promise.reject()
                }
            }
        },
        async StrongcheckA(){
            if (this.lcList.activityDefID === 'alliv01new') {
                const { code } = await nextSubCode({
                    iTAccId: this.lcList.bizObject.bizSeq,
                    prjId:this.prjId
                })
                if(+code!==200){
                    return Promise.reject()
                }
            }
        },
        // 智联服务成本下一步校验是否填写摊销起始日期
        async checkTime(){
            const params = {
                prjId:this.prjId,
                iTAccId:this.lcList.bizObject.bizSeq
            }
            const {code} = await newDoNextCheckVerfic(params)
            if(+code!==200){
                return Promise.reject()
            }
        },
        // 下一步
        async handleNext() {
            await this.checkTime()
            await this.Strongcheck()
            await this.StrongcheckA()
            var nodeNameWord = this.lcList.activityDefID // 需要参数
            var itAccId = this.lcList.bizObject.bizSeq // 需要参数
            var prjId = this.prjId
            if (nodeNameWord === 'alliv02new') {
                var secondarytype = this.basicList.secondaryType // 需要参数 基本信息接口获取
                var CURRENTINSPECTIONMONEYSUM = 0 // 项目累计验工计价金额
                var currentInvest = 0 // 项目本年总金额
                if (secondarytype === '12') {
                    // “自主研发”类IT投资项目，PMS自身先校验项目累计验工计价金额是否超预算信息时校验的是预算信息中的【项目总金额】
                    const data = {
                        serviceCode: '',
                        subPrjId: prjId,
                        prjId: prjId,
                        vId: '',
                        type: '1'
                    }
                    const insValNextCheck = await insValNextCheckNew(data)
                    if (insValNextCheck.code === '200') {
                        CURRENTINSPECTIONMONEYSUM = this.farmatMoney(
                            Number(
                                insValNextCheck.data.currentInspectionSum
                                    .CURRENT_INSPECTION_MONEY_SUM
                            )
                        )
                        currentInvest = this.farmatMoney(
                            Number(insValNextCheck.data.totalCost.TOTAL_COST)
                        )
                    }
                }
                // “自主研发”类IT投资项目，PMS自身先校验项目累计验工计价金额是否超预算信息时校验的是预算信息中的【项目总金额】
                if (CURRENTINSPECTIONMONEYSUM > currentInvest) {
                    this.$message({
                        message:
                            '项目累计验工计价金额(' +
                            CURRENTINSPECTIONMONEYSUM +
                            ')已超过项目预算信息中的项目总金额(' +
                            currentInvest +
                            ')！',
                        type: 'error'
                    })
                    return
                } else {
                    // 调用接口，校验结果未超项目本年预算时由预算系统进行二次校验；----------------------------------------------------------------------------注意调用接口
                    if (await this.checkByBudgetingSystem(itAccId)) {
                        return
                    }
                }
            }
            // if (!(await this.itInspectionValuationFileValid(nodeNameWord, itAccId))) {
            //   return
            // }
            // 附件校验
            var fileCheckFlag = await this.fileCheck()
            if (!fileCheckFlag) {
                return false
            }
            this.openWorkflowPage('', '')
        },
        // 回退
        async doBack() {
            // var nodeNameWord = this.lcList.activityDefID // 没用
            var itAccId = this.lcList.bizObject.bizSeq // 需要参数
            var prjId = this.prjId
            var isPush = '0'
            const selectIsPush = await selectIsPushNew({
                prjId: prjId,
                itAccId: itAccId
            })
            if (selectIsPush.code === '200') {
                isPush = selectIsPush.data
            }
            if (isPush >= 1) {
                // nui.alert('当前验工计价信息已推送商合系统，无法回退，请确认！')
                this.$message({
                    message:
                        '当前验工计价信息已推送商合系统，无法回退，请确认！',
                    type: 'error'
                })
                return
            } else if (isPush === 0) {
                this.openWorkflowPage('BACK', '')
            } else {
                this.$message({
                    message: '数据异常，请重试！',
                    type: 'error'
                })
                // nui.alert('数据异常，请重试！')
                return
            }
        },
        async openWorkflowPagerepairOne(queryTheNextStepFlag){
            if (queryTheNextStepFlag.code === '200') {
                this.ifFlagVal = queryTheNextStepFlag.data
            }
        },
        async openWorkflowPagerepairTwo(nextFlag){
            // 打开弹框参数
            if (nextFlag === 'BACK') {
                this.workFlowData = {
                    processInstID: this.lcList.processInstID,
                    actInsetId: this.lcList.activityInstID
                }
                this.backPageVisible = true
            }
        },
        async openWorkflowPagerepairThree(){
            if (this.ifFlagVal === '20' || this.ifFlagVal === '10') {
                this.ifFlagVal = ''
            }
        },
        async openWorkflowPagerepairFour(nextFlag){
            if (nextFlag === '') {
                this.workFlowData = {
                    activityInstID: this.lcList.activityInstID,
                    processInstID: this.lcList.processInstID,
                    route: this.ifFlagVal,
                    activityDefID: this.lcList.activityDefID,
                    processDefName: this.lcList.processInstName
                }
                this.nextPageVisible = true
            }
        },
        async openWorkflowPagerepairFive(isPush,itAccId,prjId){
            if (isPush === '0') {
                // 推送商合前先将IT验工计价信息写入验工计价信息正式表
                if (!(await this.itInsValSentToSH(itAccId, prjId))) {
                    return Promise.reject()
                }
            } else if (isPush >= '1') {
                // 推送过
                console.log("1");
            } else {
                this.$message({
                    message: '数据异常，请重试！',
                    type: 'error'
                })
                return Promise.reject()
            }
        },
        async openWorkflowPage(nextFlag) {
            var template =
                'cn.chinatowercom.pms.pmsflow.info_it_inspectionValuation_all'
            // 建设id
            var nodeNameWord = this.lcList.activityDefID
            var createUnit = this.basicInfoList.createUnit // 需要参数 注意
            const queryTheNextStepFlag = await queryTheNextStepFlagNew({
                orgId: createUnit,
                templateId: template,
                nodeId: nodeNameWord,
                prjId:this.prjId,
                workItemId:this.query.workItemId
            })
            await this.openWorkflowPagerepairOne(queryTheNextStepFlag)
            if (this.ifFlagVal === '1000' && nextFlag === '') {
                // 流程结束时
                var isPush = '0' // 需要参数
                var itAccId = this.lcList.bizObject.bizSeq // 需要参数
                var prjId = this.prjId // 需要参数
                const selectIsPush = await selectIsPushNew({
                    prjId: prjId,
                    itAccId: itAccId
                })
                if (selectIsPush.code === '200'&&selectIsPush.data) {
                    isPush = selectIsPush.data
                }
                await this.openWorkflowPagerepairFive(isPush,itAccId,prjId)
            }
            await this.openWorkflowPagerepairTwo(nextFlag)
            await this.openWorkflowPagerepairThree()
            await this.openWorkflowPagerepairFour(nextFlag)
        },
        // 取消申请
        async deleteApproval() {
            localStorage.setItem('pmsZrCheckoutValuation', 0)
            var flag = false
            var itAccId = this.lcList.bizObject.bizSeq // 需要参数
            var processInstID = this.lcList.processInstID // 需要参数

            const getItInspection = await getItInspectionNew({
                itAccId: itAccId
            })
            if (getItInspection.code === '200') {
                var resultMess = getItInspection.data
                if (resultMess === 'err') {
                    flag = true
                }
            }
            if (flag) {
                this.$message({
                    message:
                        '请将本次填写的验工计价信息删除在取消本次验工计价！',
                    type: 'error'
                })
                // nui.alert("请将本次填写的验工计价信息删除在取消本次验工计价！")
                return
            }
            this.$confirm('是否取消此次验工计价?', '系统提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                cancelButtonClass: 'pms-zr-button',
                confirmButtonClass: 'pms-zr-button-primary',
                type: 'warning'
            })
                .then(async() => {
                    var itAccId001 = itAccId
                    // 取消验工计价流程时，在用户把验工计价都删除后，可以取消验工计价流程，取消时先调用预算控制接口。
                    // 场景1、本次验工计价流程没有推送过预算。 同时验工计价都被删除，接口直接返回成功，可以取消流程。
                    // 2、本次验工计价流程，已经把验工计价推送过给预算系统。需要给财务推送对应的负数进行冲销，冲销成功后接口返回成功，可以取消流程。
                    // 3、如果预算控制接口返回失败，不允许取消验工计价流程。
                    if (await this.checkByBudgetingSystem(itAccId001)) {
                        return
                    }
                    this.cancelInspectionVaWorkflow(itAccId001, processInstID)
                })
                .catch(() => {
                    console.log("catch");
                })
        },
        // 获取验工计价基本信息
        cInspectionForm(form) {
            this.cInspectionFormData = form
        },
        // 获取验工计价详情
        inspectionValuationDetails(tableData) {
            this.inspectionValuationDetailsData = tableData
        },
        // 推送预算系统校验
        async checkByBudgetingSystem(itAccId) {
            var returnFlag = false
            const budgetControlByItAccId = await budgetControlByItAccIdNew({
                itAccId: itAccId
            })
            if (budgetControlByItAccId.code !== '200') {
                returnFlag = true
            }
            return returnFlag
        },
        // 附件必传上传
        async fileCheck() {
            const show = this.basicList.isNewbusiness==='1'&&['25','29'].includes(this.basicList.buildModes)
            var fjData = {
                prjId:show?this.lcList?.bizObject?.bizSeq: this.prjId,
                eventType: '1',
                nodeId: this.lcList.activityDefID
            }
            const checkValid = await checkValidNew(fjData)
            if (checkValid.code !== '200') {
                var docTypeNameVal = []
                checkValid.data.map((v) => {
                    docTypeNameVal.push(v.docTypeName)
                })
                this.$message({
                    message:'当前节点必传以下附件'+`【${docTypeNameVal.join('、')}】`,
                    type: 'error'
                    })             
                return false
            }
            return true
        },
        handleOnlyClose() {
           clonePage()
        },
        async cancelInspectionVaWorkflow(itAccId001, processInstID) {
            const cancelInspectionVaWorkflow =
                await cancelInspectionVaWorkflowNew({
                    itAccId: itAccId001,
                    procInstId: processInstID
                })
            if (cancelInspectionVaWorkflow.code === '200') {
              clonePage()
                // this.$message({
                //     message: cancelInspectionVaWorkflow.message,
                //     type: 'success'
                // })
                // this.handleOnlyClose()
            }
        },
        async itInsValSentToSH(itAccId, prjId) {
            var isOk = false
            const itInsValSentToSH = await itInsValSentToSHNew({
                itAccId: itAccId,
                prjId: prjId
            })
            if (itInsValSentToSH.code === '200') {
                isOk = true
            }
            return isOk
        },

        // 下一步确认回调
        async nextPageRes(item) {
            const ifNextVal = '1' // 下一步传 1
            this.nextBackPageRes(item, ifNextVal)
        },
        // 退回确认回调
        async backPageRes(item) {
            const ifNextVal = '2' // 回退传2
            this.nextBackPageRes(item, ifNextVal)
            console.log('111111')
        },
        // 下一步 && 回退
        async nextBackPageRes(item, ifNextVal) {
            console.log(ifNextVal, 'ifNextVal')
            // var workFlowFlag = ''
            var messageVal = ''
            var data = {
                route: this.ifFlagVal,
                workItemId: this.$route.query.workItemId,
                userIds: item.empId,
                opinion: item.opinion,
                itAccId: this.lcList.bizObject.bizSeq,
                actInsetId: this.lcList.activityInstID,
                processInstID: this.lcList.processInstID
            }
            var bakData = {
                workitemId: this.$route.query.workItemId,
                opinion: item.opinion,
                itAccId: this.lcList.bizObject.bizSeq,
                detailId: item.detailId,
                nextActDefId: item.nodeId, // 回退下一步
                sceneId: item.sceneId // 下一步节点返回的
            }
            if (ifNextVal === '1') {
                // workFlowFlag = 'doNext'
                messageVal = '提交成功'
                const insValFlowBiz = await insValFlowBizNew(data)
                if (insValFlowBiz.code === '200') {
                    this.$message({
                        message: messageVal,
                        type: 'success'
                    })
                    clonePage()
                }
            } else {
                // workFlowFlag = 'doBack'
                messageVal = '回退成功'
                const insValFlowBackBiz = await insValFlowBackBizNew(
                    bakData
                )
                if (insValFlowBackBiz.code === '200') {
                    this.$message({
                        message: messageVal,
                        type: 'success'
                    })
                    clonePage()
                }
            }
        },
        farmatMoney(money) {
            // 四舍五入保留2位小数
            var pum = 0
            if (money < 0) {
                pum = -money
            } else {
                pum = money
            }
            var value = Math.round(pum * Math.pow(10, 2)) / Math.pow(10, 2)
            if (money < 0) {
                return -value
            } else {
                return value
            }
        },
        // 查看考核结果
        async LookaSsessResult(prams) {
            if (!prams.month) {
                this.$message({
                    message:
                        '验工计价月份不能为空，请选择验工计价月份后重新点击【查看考核结果】!',
                    type: 'error'
                })
                return
            }
            var getUserInfoList = {}
            var applyTokenByCodeList = {}
            const getUserInfo = await getUserInfoNew({})
            if (getUserInfo.code === '200') {
                getUserInfoList = getUserInfo.data
            }
            const applyTokenByCode = await applyTokenByCodeNew({
                serviceId: 'CHNTPCS',
                loginAcct: getUserInfoList.user.loginName
            })
            if (applyTokenByCode.code === '200') {
                applyTokenByCodeList = applyTokenByCode.data
            }
            var managerAccountMd5 = ''
            const generateMD = await generateMDNew({
                account: this.lcList.participant,
                systemCode: 'CHNTPCS'
            })
            if (generateMD.code === '200') {
                managerAccountMd5 = generateMD.data
            }
            var params = {}
            params.managerAccountMd5 = managerAccountMd5 // managerAccountMd5= account + 盐  （md5加密  盐值= CHNTPCS）*
            params.acctId = applyTokenByCodeList.ACCTID // 系统唯一标识*
            params.account = this.lcList.participant // 登录人账号（zhangsan3）*
            params.yearMonth = prams.month // 月度考核表年月（2023-10）*
            const toUrl = `${process.env.VUE_APP_LIUSHUIXIAN_URL}scoring?acctId=${params.acctId}&managerAccountMd5=${params.managerAccountMd5}&account=${params.account}&yearMonth=${params.yearMonth}`
            window.open(toUrl, 'toUrl')
        }
    }
}
</script>
<style lang="scss" scoped>
.flex-layout {
    display: flex;
    width: 100%;
    height: 60px;
    background: #fff !important;
    border: 1px solid #ebeef5;
    transition: border-bottom-color 0.3s;
    align-items: center;
    justify-content: center;
}
::v-deep.el-collapse-item {
    box-shadow: none;
    /* 调整各个item之间的距离为20px */
    border: 1px solid #ebeef5 !important;
}
</style>
